import HDiscover from "pages/discover";
import HMine from "pages/mine";
import HFriends from "pages/friends";

// discover的子路由
import HAlbum from "pages/discover/child-pages/album";
import HRecommend from "pages/discover/child-pages/recommend";
import HArtist from "pages/discover/child-pages/artist";
import HDjradio from "pages/discover/child-pages/djradio";
import HRanking from "pages/discover/child-pages/ranking";
import HSongs from "pages/discover/child-pages/songs";

import {Redirect } from "react-router-dom";
const routers = [
  {
    // 路由匹配成功时，执行render函数，将返回的Redirect组件渲染到页面，从而进行路由重定向。
    path:"/",
    exact:true,
    render: ()=> <Redirect to={"/discover"}/>
  },
  {
    path:"/discover",
    component:HDiscover,
    routes:[
      {
        path:"/discover",
        exact:true,
        render: ()=> <Redirect to={"/discover/recommend"} />
      },
      {
        path:"/discover/recommend",
        exact:true,
        component: HRecommend
      },
      {
        path:"/discover/album",
        exact:true,
        component: HAlbum
      },
      {
        path:"/discover/artist",
        exact:true,
        component: HArtist
      },
      {
        path:"/discover/djradio",
        exact:true,
        component: HDjradio
      },
      {
        path:"/discover/songs",
        exact:true,
        component: HSongs
      },
      {
        path:"/discover/ranking",
        exact:true,
        component: HRanking
      },

    ]
  },
  {
    path:"/mine",
    exact:true,
    component:HMine
  },
  {
    path:"/friends",
    exact:true,
    component:HFriends
  },
]

export default routers;
